package com.ruoyi.web.controller.ydz;

import java.util.List;

import com.ruoyi.web.domain.JapanNewsTdk;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.domain.JapanExaminationTdk;
import com.ruoyi.web.service.IJapanExaminationTdkService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 日本体检TDK配置Controller
 * 
 * @author drx
 * @date 2025-05-19
 */
@Controller
@RequestMapping("/ydz/examinationTdk")
@Api(tags = "日本体检TDK配置")
public class JapanExaminationTdkController extends BaseController
{
    private String prefix = "ydz/examinationTdk";

    @Autowired
    private IJapanExaminationTdkService japanExaminationTdkService;

    @RequiresPermissions("ydz:examinationTdk:view")
    @GetMapping()
    public String tdk()
    {
        return prefix + "/examinationTdk";
    }

    /**
     * 查询日本体检TDK配置列表
     */
    @RequiresPermissions("ydz:examinationTdk:list")
    @PostMapping("/list")
    @ResponseBody
    @ApiOperation("查询日本体检TDK配置列表")
    public TableDataInfo list(JapanExaminationTdk japanExaminationTdk)
    {
        startPage();
        List<JapanExaminationTdk> list = japanExaminationTdkService.selectJapanExaminationTdkList(japanExaminationTdk);
        return getDataTable(list);
    }

    /**
     * 导出日本体检TDK配置列表
     */
    @RequiresPermissions("ydz:examinationTdk:export")
    @Log(title = "日本体检TDK配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    @ApiOperation("导出日本体检TDK配置列表")
    public AjaxResult export(JapanExaminationTdk japanExaminationTdk)
    {
        List<JapanExaminationTdk> list = japanExaminationTdkService.selectJapanExaminationTdkList(japanExaminationTdk);
        ExcelUtil<JapanExaminationTdk> util = new ExcelUtil<JapanExaminationTdk>(JapanExaminationTdk.class);
        return util.exportExcel(list, "日本体检TDK配置数据");
    }

    /**
     * 新增日本体检TDK配置
     */
    @GetMapping("/add")
    @ApiOperation("新增日本体检TDK配置")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存日本体检TDK配置
     */
    @ApiOperation("新增保存日本体检TDK配置")
    @RequiresPermissions("ydz:examinationTdk:add")
    @Log(title = "日本体检TDK配置", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JapanExaminationTdk japanExaminationTdk)
    {
        return toAjax(japanExaminationTdkService.insertJapanExaminationTdk(japanExaminationTdk));
    }

    /**
     * 修改日本体检TDK配置
     */
    @ApiOperation("修改日本体检TDK配置")
    @RequiresPermissions("ydz:examinationTdk:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        JapanExaminationTdk japanExaminationTdk = japanExaminationTdkService.selectJapanExaminationTdkById(id);
        mmap.put("japanExaminationTdk", japanExaminationTdk);
        return prefix + "/edit";
    }

    /**
     * 修改保存日本体检TDK配置
     */
    @ApiOperation("修改保存日本体检TDK配置")
    @RequiresPermissions("ydz:examinationTdk:edit")
    @Log(title = "日本体检TDK配置", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JapanExaminationTdk japanExaminationTdk)
    {
        return toAjax(japanExaminationTdkService.updateJapanExaminationTdk(japanExaminationTdk));
    }

    /**
     * 删除日本体检TDK配置
     */
    @ApiOperation("删除日本体检TDK配置")
    @RequiresPermissions("ydz:examinationTdk:remove")
    @Log(title = "日本体检TDK配置", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(japanExaminationTdkService.deleteJapanExaminationTdkByIds(ids));
    }

    /**
     * 修改保存日本看病新闻配置
     */
    @ApiOperation("修改保存新闻管理")
    @RequiresPermissions("ydz:examinationTdk:edit")
    @Log(title = "新闻管理", businessType = BusinessType.UPDATE)
    @PostMapping("/editExaminationTdkSet")
    @ResponseBody
    public AjaxResult editExaminationTdkSet(@RequestBody List<JapanExaminationTdk> list)
    {
        return japanExaminationTdkService.editExaminationTdkSet(list);
    }
}
